home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / utils / bibclean / xstdlib.h < prev    next >
C/C++ Source or Header  |  1992-11-17  |  7KB  |  201 lines

  1. /* -*-C-*- xstdlib.h */
  2. /**********************************************************************/
  3. /****************************** stdlib ********************************/
  4. /**********************************************************************/
  5.  
  6. /* $Id: xstdlib.h,v 1.6 1992/10/08 01:42:01 beebe Exp beebe $
  7.  * $Log: xstdlib.h,v $
  8.  * Revision 1.6  1992/10/08  01:42:01  beebe
  9.  * Update for C++.
  10.  *
  11.  * Revision 1.5  1992/07/10  18:07:27  beebe
  12.  * Remove Lattice C support.
  13.  * Add some preprocessor statement comments.
  14.  *
  15.  * Revision 1.4  1992/03/10  00:33:39  beebe
  16.  * *** empty log message ***
  17.  *
  18.  * Revision 1.3  1992/03/06  14:58:06  beebe
  19.  * Complete two-month long development of version 3.0.114.  See
  20.  * 00revhst.txt for details.
  21.  *
  22.  * Revision 1.2  1992/02/29  19:42:20  beebe
  23.  * Update for version 3.0.114 [29-Feb-1992] following two-month
  24.  * major overhaul and compilation testing on numerous machines.
  25.  *
  26.  * Revision 1.2  1992/02/29  19:42:20  beebe
  27.  * Update for version 3.0.114 [29-Feb-1992] following two-month
  28.  * major overhaul and compilation testing on numerous machines.
  29.  *
  30.  */
  31.  
  32. #ifndef XSTDLIB_H_DEFINED_
  33. #define XSTDLIB_H_DEFINED_
  34.  
  35. /***********************************************************************
  36. This file provides function prototype definitions for the C library.  It
  37. can be used for environments where no system stdlib.h file is available,
  38. such as for GNU gcc in non-ANSI UNIX C implementations.     Note that some
  39. older implementations may have different function return values, so some
  40. care should be exercised in using this file.
  41.  
  42. Functions are ordered alphabetically below in two groups, each of two
  43. sections, one with ANSI-style prototypes, and one with old-style
  44. prototypes.
  45.  
  46. The first group contains the functions that belong to ANSI stdlib.h.
  47.  
  48. The second group contains miscellaneous other library functions that
  49. have prototypes in other ANSI header files, but often lack prototypes in
  50. typical non-ANSI C implementations.
  51.  
  52. [29-Jan-1992]
  53. ***********************************************************************/
  54.  
  55. #if    STDC || HAVE_STDLIB_H
  56.  
  57. #include <stdlib.h>            /* get the host version */
  58.  
  59. #if __cplusplus
  60. extern "C"
  61. {    /* HP 370 BSD 4.3 CC 2.0 is missing strtol in system .h files */
  62. long        strtol ARGS((const char *nptr_,  char** endptr_,
  63.             int base_));
  64. };
  65. #else /* NOT __cplusplus */
  66.  
  67. #if sun                    /* SunOS 4.1 stdlib.h is incomplete */
  68. double        strtod ARGS((const char *nptr_,  char** endptr_));
  69. char        *strtok ARGS((char *s_, const char *sepchars_));
  70. long        strtol ARGS((const char *nptr_,  char** endptr_,
  71.             int base_));
  72. unsigned long    strtoul ARGS((const char *nptr_,  char** endptr_,
  73.             int base_));
  74. #endif /* sun */
  75.  
  76. #if    _AIX370
  77. unsigned long    strtoul ARGS((const char *nptr_,  char** endptr_,
  78.             int base_));
  79. #endif /* _AIX370 */
  80.  
  81. #if    _AIX
  82. #include <unistd.h>    /* for EXIT_SUCCESS and EXIT_FAILURE */
  83.             /* which SHOULD be in stdlib.h, but are not */
  84.             /* on some AIX mainframe and PS/2 implementations */
  85. #endif /* _AIX */
  86.  
  87. #endif /* !__cplusplus */
  88.  
  89. #else  /* NOT (STDC || HAVE_STDLIB_H) */
  90.  
  91. #include "xtypes.h"
  92.  
  93. /* Here is the contents of Standard C's stdlib.h.  Standard C reserves
  94. names beginning with the regular expressions __ and _[A-Z] for
  95. implementors, and C++ reserves names containing anywhere double
  96. underscores.  To avoid conflict with such names, we use a single
  97. trailing underscore instead for private names. */
  98.  
  99. typedef int                 onexit_t;
  100. typedef struct { int quot; int rem; }    div_t;
  101. typedef struct { long quot; long rem; } ldiv_t;
  102. typedef    unsigned int            wchar_t;
  103.  
  104. #ifdef ungetc
  105. #undef ungetc        /* Turbo C macro conflicts with prototypes below */
  106. #endif /* ungetc */
  107.  
  108. void        abort ARGS((void));
  109. int        abs ARGS((int j_));
  110. int        atexit ARGS((void (*func)(void)));
  111. double        atof ARGS((const char *nptr_));
  112. int        atoi ARGS((const char *nptr_));
  113. long        atol ARGS((const char *nptr_));
  114. char        *bsearch ARGS((const void *key_,  const void *base_,
  115.             size_t nmemb_, size_t size_,
  116.             int (*compar)(const void*, const void* )));
  117. void        *calloc ARGS((size_t nmemb_,  size_t size_));
  118. div_t        div ARGS((int numer_,  int denom_));
  119. void        exit ARGS((int status_));
  120. void        free ARGS((void *ptr_));
  121. char        *getenv ARGS((const char *name_));
  122. long        labs ARGS((long j_));
  123. ldiv_t        ldiv ARGS((long numer_,  long denom_));
  124. void        *malloc ARGS((size_t size_));
  125.  
  126. #ifndef MB_CUR_MAX
  127. #define    MB_CUR_MAX 4            /* this is SYSTEM-DEPENDENT */
  128. #endif /* MB_CUR_MAX */
  129.  
  130. int        mblen ARGS((const char *s_, size_t n_));
  131. size_t        mbstowcs ARGS((wchar_t *pwcs_, const char *s_, size_t n_));
  132. int        mbtowc ARGS((wchar_t *pwc_, const char *s_, size_t n_));
  133.  
  134.  
  135. onexit_t    onexit ARGS((onexit_t (*func)(void)));
  136.  
  137. #ifndef NULL
  138. #if    KCC_20
  139. /* has its own version in stdio.h */
  140. #else  /* NOT KCC_20 */
  141. #define NULL            ((VOIDP) 0L)    /* this is SYSTEM-DEPENDENT */
  142. #endif /* KCC_20 */
  143. #endif /* NULL */
  144.  
  145. void        qsort ARGS((void *base_,  size_t nmemb_,  size_t size_,
  146.             int (*compar)(const void* , const void* )));
  147. int        rand ARGS((void));
  148.  
  149. #ifndef RAND_MAX
  150. #define    RAND_MAX 32767            /* this is SYSTEM-DEPENDENT */
  151. #endif /* RAND_MAX */
  152.  
  153. void        *realloc ARGS((void *ptr_,  size_t size_));
  154. void        srand ARGS((unsigned int seed_));
  155. double        strtod ARGS((const char *nptr_,  char** endptr_));
  156. char        *strtok ARGS((char *s_, const char *sepchars_));
  157. long        strtol ARGS((const char *nptr_,  char** endptr_,
  158.             int base_));
  159. unsigned long    strtoul ARGS((const char *nptr_,  char** endptr_,
  160.             int base_));
  161. int        system ARGS((const char *string_));
  162. size_t        wcstombs ARGS((char *s_, const wchar_t *pwcs_, size_t n_));
  163. int        wctomb ARGS((char *s_, wchar_t wchar_));
  164.  
  165. #endif /* STDC || HAVE_STDLIB_H */
  166.  
  167. #if    VMS
  168.  
  169. /***********************************************************************
  170. Under VAX VMS 3.x  and  4.x, exit(n) and return(n)  treat n as a VAX VMS
  171. status code, where odd n means success, and even n means failure.  Under
  172. VMS 5.x, return(n)  still acts this way, but  exit(n) means success if n
  173. == 0,  and failure  if n !=  0,  bringing it into  agreement  with other
  174. exit() implementations.  Prior to VMS 5.x, EXIT_FAILURE and EXIT_SUCCESS
  175. were not defined in stdlib.h; they  are in VMS 5.x.   The code here will
  176. therefore leave the new definitions unchanged,  and supply them on older
  177. VMS systems.
  178. ***********************************************************************/
  179.  
  180. #ifndef EXIT_FAILURE
  181. #define EXIT_FAILURE    ((1 << 28) + 2) /* (suppresses %NONAME-E-NOMSG) */
  182. #endif /* EXIT_FAILURE */
  183.  
  184. #ifndef EXIT_SUCCESS
  185. #define EXIT_SUCCESS    (1)
  186. #endif /* EXIT_SUCCESS */
  187.  
  188. #else  /* NOT VMS */
  189.  
  190. #ifndef EXIT_FAILURE
  191. #define EXIT_FAILURE    (1)
  192. #endif /* EXIT_FAILURE */
  193.  
  194. #ifndef EXIT_SUCCESS
  195. #define EXIT_SUCCESS    (0)
  196. #endif /* EXIT_SUCCESS */
  197.  
  198. #endif /* VMS */
  199.  
  200. #endif /* XSTDLIB_H_DEFINED_ */
  201.